<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Security-Policy" content="
        default-src 'none'; 
        style-src {{cspSource}} 'unsafe-inline'; 
        script-src 'nonce-{{nonce}}'; 
        img-src {{cspSource}} https:;
        font-src {{cspSource}};
    ">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link href="{{baseCssUri}}" rel="stylesheet">
    <link href="{{layoutCssUri}}" rel="stylesheet">
    <link href="{{componentsCssUri}}" rel="stylesheet">
    
    <link href="{{chatCssUri}}" rel="stylesheet">
    <link href="{{toolsCssUri}}" rel="stylesheet">
    <link href="{{attachmentsCssUri}}" rel="stylesheet">
    <link href="{{commandCssUri}}" rel="stylesheet">

    <!-- Codicon 图标样式 -->
    <link href="{{codiconCssUri}}" rel="stylesheet">

    <link href="{{copilotThemeCssUri}}" rel="stylesheet">

    <title>TestAgent</title>
</head>
<body>
    <div id="display-area">

        <!-- 聊天记录 -->
        <div id="chat-view" class="view-content active">
            <div class="welcome-message">
                <h3><span class="codicon codicon-sparkle"></span> TestAgent AI</h3>
                <p>Select method to start generation.</p>
            </div>
            <div id="messages-container"></div>
        </div>

        <!-- 工具执行结果 -->
        <div id="tool-result-view" class="view-content">
            <h4><span class="codicon codicon-list-selection"></span> Tool Results</h4>
            <div id="tool-result-content">
                <p class="placeholder-text">Select a tool to view results</p>
            </div>
        </div>
    </div>

    <div id="control-area">

        <div id="command-bar">
            <vscode-button id="select-project-button" appearance="icon" title="选择被测项目">
                <span class="codicon codicon-folder"></span>
            </vscode-button>
            <vscode-button id="generate-ckg-button" appearance="icon" title="生成知识图谱">
                <span class="codicon codicon-graph"></span>
            </vscode-button>
            <vscode-button id="open-config-button" appearance="icon" title="环境配置">
                <span class="codicon codicon-settings-gear"></span>
            </vscode-button>
            <div id="assist-mode-control" class="assist-mode-control">
                <vscode-button id="assist-mode-button" class="assist-mode-button" appearance="secondary" title="人类介入">
                    <span class="codicon codicon-person"></span>
                </vscode-button>
                <div id="assist-mode-dropdown" class="assist-dropdown">
                    <div class="assist-option selected" data-mode="auto">自主完成</div>
                    <div class="assist-option" data-mode="human">人类介入</div>
                </div>
            </div>
        </div>

        <div id="method-selector" class="method-selector">
            <vscode-button id="method-dropdown-button" appearance="secondary">
                <span class="codicon codicon-symbol-method"></span>
                <span>方法列表</span>
                <span class="codicon codicon-chevron-down dropdown-caret"></span>
            </vscode-button>
            <div id="method-dropdown" class="tool-dropdown method-dropdown">
                <p class="method-dropdown-empty">暂无可用方法</p>
            </div>
        </div>

        <!-- 已选方法显示区域 -->
        <div id="selected-methods-area" class="attachments-container" style="display: none;">
            <div class="attachments-header">
                <span class="codicon codicon-symbol-method"></span>
                <span>已选方法</span>
            </div>
            <div id="selected-methods-list" class="attachments-list"></div>
        </div>

        <!-- 输入框-->
        <div id="input-bar">
            <!-- 提升默认高度到 3 行，便于输入 -->
            <vscode-text-area id="user-input" placeholder="选择方法后点击“开始生成”..." resize="vertical" rows="3"></vscode-text-area>
            <vscode-button appearance="primary" id="send-button" title="开始生成">
                <span class="codicon codicon-play"></span>
                <span>开始生成</span>
            </vscode-button>
        </div>
    </div>
    <!-- VS Code Webview UI Toolkit -->
    <script type="module" nonce="{{nonce}}" src="{{toolkitUri}}"></script>
    
    <!-- 🟢 错误边界 - 必须最先加载 -->
    <script nonce="{{nonce}}" src="{{errorBoundaryUri}}"></script>
    
    <!-- 模块化脚本按依赖顺序加载 (使用 IIFE 模式) -->
    <script nonce="{{nonce}}" src="{{vsCodeAdapterUri}}"></script>
    
    <script nonce="{{nonce}}" src="{{dialogComponentUri}}"></script>
    
    <script nonce="{{nonce}}" src="{{messageViewUri}}"></script>
    <script nonce="{{nonce}}" src="{{inputViewUri}}"></script>
    <script nonce="{{nonce}}" src="{{toolResultViewUri}}"></script>
    <script nonce="{{nonce}}" src="{{methodSelectorUri}}"></script>
    
    <script nonce="{{nonce}}" src="{{appControllerUri}}"></script>
    
    <script nonce="{{nonce}}" src="{{mainUri}}"></script>
</body>
</html>
